Skip to content

run-tests: Add {TEST_NAME} placeholder storing the basename of the test file - #23472

Open
TimWolla wants to merge 1 commit into
php:masterfrom
TimWolla:run-tests-test-name-placeholder
Open

run-tests: Add {TEST_NAME} placeholder storing the basename of the test file#23472
TimWolla wants to merge 1 commit into
php:masterfrom
TimWolla:run-tests-test-name-placeholder

Conversation

@TimWolla

Copy link
Copy Markdown
Member

This makes it easier to write tests with associated temporary files in a conflict-free way without needing to copy-and-paste the filename everywhere.

…test file

This makes it easier to write tests with associated temporary files in a
conflict-free way without needing to copy-and-paste the filename everywhere.
@TimWolla
TimWolla requested a review from Girgias August 26, 2026 15:40
@TimWolla
TimWolla requested a review from bukka as a code owner August 26, 2026 15:40

@jorgsowa jorgsowa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea. What do you think about more clarity, i.e. TEST_FILE_BASENAME or TEST_FILE_NAME.

@TimWolla

Copy link
Copy Markdown
Member Author

What do you think about more clarity

I wanted to avoid the extra verbosity, since using the placeholder is an explicit action (it doesn't magically create an environment variable where namespacing might be desirable).

@NickSdot

NickSdot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Hey Tim,

I spent the last weeks with related stuff. Please allow me to offer my observations:

  • INI expansion: the PR will replace foo=${TEST_NAME} with foo=$gh19188_mixed_mode (note the $); nasty foot gun.
  • this is not really conflict-free: A) {TMP}/{TEST_NAME} can conflict between same-name tests in different directories B) a single test run conflicts with a same-time full suite run C) in agentic times an agent and you might run the same suite in the same time with different configs.
  • docs "no file used by any test should have"; the existing test uses .out and so does yours; adding something new should guardrail against this.

I know, literally all of this exists in old tests. But this are exactly the issues we have to solve to get the suite concurrency safe. We should not extend on decade old sins (that are copied over and over today) with new functionality.

Extra nits: --ENV-- is boilerplate; TEST_NAME is misnamed, because $test->getName() is --TEST-- content.

In the wider context of #22917 and #22995 I will soon propose something that could solve all this. Main goal of mine is a concurrency safe test suite, better performance, and general test API ergonomics; but it happens to also solve what you are attempting here. Would be cool if y'all would wait with this one until I am ready to show what I've been working on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants